package jml.plugins.parche;

import jml.def.Library;
import jml.def.Plugin;
import jml.def.Title;
import jml.plugins.justadded.JustAdded;
import jml.plugins.mostplayed.MostPlayed;
import jml.plugins.recents.RecentlyHear;

public class Parche extends Plugin
{
	@Override
	public void onLoad(Title t)
	{
		// JustAdded
//		procesar(t, "fechaAlta", JustAdded.class);
		
		// MostPlayed
		procesar(t, "fAdded", MostPlayed.class);
		procesar(t, "nClicks", MostPlayed.class);
		
		// LastListener
		procesar(t,"lastListened",RecentlyHear.class);
	}
	
	private void procesar(Title t, String cookieName,Class<?> w)
	{
		String x = t.loadPrivateCookie(cookieName,w);
		if( x!=null ) 
		{
			t.removePrivateCookie(cookieName,w);
		}
	}

	@Override
	public void onPlay(Title t)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onEdit(Title t)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onRefresh(Library t)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onOpenLabel(String filter, String label)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void beforeLoading(Library lib)
	{
		// TODO Auto-generated method stub
		
	}

	@Override
	public void afterLoading(Library lib)
	{
		// TODO Auto-generated method stub
		
	} 

}
